package day2;

import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class Util {
    static volatile JedisPool pool;
    private Util(){
    }
    public static JedisPool getInstance(){
        if(null==pool){
            synchronized (Util.class){
                if(null==pool){
                    JedisPoolConfig cfg=new JedisPoolConfig();
                    cfg.setMaxTotal(20);
                    cfg.setMaxIdle(10);
                    pool=new JedisPool(cfg,"192.168.188.100",6379);
                }
            }
        }
        return pool;
    }
}
